//
//  OverSeaViewController.swift
//  koolcar
//
//  Created by xiantian on 2023/12/4.
//
import UIKit
import MJRefresh
import FacebookShare

class OverSeaViewController: BaseViewController {
    var loginBtn: UIButton!
    var messageBtn: UIButton!
    var newMesRed: UIView!//信息红点
    var tableView: BaseTableView!
    var signInBtn: UIButton!
    var customerServiceBtn: UIImageLabelButton!
    var signModel: SignInDataModel!
    var hotVehicleArray: [VehicleLisetModel] = []//热门车辆
    var recommendedArray: [VehicleLisetModel] = []//推荐车辆
    var pageNumber = 1
    var loadingFlag: Bool = false
    var goTopBtn: UIButton = {
        let tempBtn = UIButton()
        tempBtn.setup_image(image: UIImage.init(named: "icon_suspend"))
        tempBtn.isHidden = true
        return tempBtn
    }()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        self.initNav()
        self.initTableView()
        self.initKeFu()
        goTopBtn.addTarget(self, action: #selector(goTopBtnAction), for: .touchUpInside)
        self.view.addSubview(self.goTopBtn)
        NotificationCenter.default.addObserver(self, selector: #selector(receiveJpushMsgTypeDeal(notification:)), name: NSNotification.Name(XTManageCenter.JpushMsgType), object: nil)
        self.addSnpLayout()
    }
    
    
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        self.requestSignIn()
        self.requestPromotionzActivity()
        self.fetchGetOneCodeKey()
    }
    
    override func viewDidDisappear(_ animated: Bool) {
        super.viewDidDisappear(animated)
        NotificationCenter.default.removeObserver(self)
    }
    
    private func addSnpLayout(){
        self.goTopBtn.snp.makeConstraints { make in
            make.left.equalTo(12)
            make.width.equalTo(34)
            make.height.equalTo(34)
            make.bottom.equalTo(-TabbarHeight-64)
        }
    }
    
    
    @objc func goTopBtnAction(){
        self.tableView.scrollToTop(animated: true)
    }
    
    //复制口令分享弹框
    func applicationWillEnterForeground(){
        //只在首页弹出
        guard let tabbarVC = UIApplication.shared.keyWindow?.rootViewController as? BaseTabbarController else {
            return
        }
        if tabbarVC.selectedIndex == 0 {
            let homeNavi = tabbarVC.childViewControllers[0] as? BaseNavigationController
            if (homeNavi?.viewControllers.count == 1) {
                self.fetchGetOneCodeKey()
            }
        }
    }
    
    
    func initNav(){
        
        let logoImageView = UIImageView(frame: CGRect(x: 14, y: NavBarHight - 40, width: 94, height: 30))
        logoImageView.image = UIImage(named: "icon_home_logo")
        self.navBar.addSubview(logoImageView)
        self.navBar.wr_setBottomLineHidden(hidden: true)
        
        
        signInBtn = UIButton(frame: CGRect(x: kScreenWidth - 160, y: NavBarHight - 40, width: 70, height: 30))
        signInBtn.setBackgroundImage(self.initLayer(frme: signInBtn.frame), for: .normal)
        signInBtn.setTitleColor(Theme.titleLabColor, for: .normal)
        signInBtn.titleLabel?.font = UIFont.init(name: Theme.PingFangSCRegular, size: 13)
        signInBtn.layer.cornerRadius = 15
        signInBtn.clipsToBounds = true
        signInBtn.setImage(UIImage(named: "icon_signin"), for: .normal)
//        signInBtn.setTitle(MMLocalizedString("sign_in", comment: "签到"), for: .normal)
        signInBtn.titleEdgeInsets = UIEdgeInsets(top: 0, left: 2, bottom: 0, right: 0)
        signInBtn.addTarget(self, action: #selector(signInBtnBtnAtion), for: .touchUpInside)
        self.navBar.addSubview(signInBtn)
        
        
        self.messageBtn = UIButton(frame: CGRect(x: kScreenWidth - 75, y: NavBarHight - 40, width: 30, height: 30))
        self.messageBtn.setImage(UIImage(named: "icon_news_msg"), for: .normal)
        self.messageBtn.contentMode = .scaleAspectFill
        self.messageBtn.addTarget(self, action: #selector(messageBtnAtion), for: .touchUpInside)
        self.navBar.addSubview(self.messageBtn)
        
        
        self.newMesRed = UIView(frame: CGRect(x: self.messageBtn.frame.size.width - 12, y: 4, width: 4, height: 4))
        self.newMesRed.backgroundColor = Theme.redColor
        self.newMesRed.layer.cornerRadius = 2
        self.newMesRed.layer.masksToBounds = true
        self.newMesRed.isHidden = true
        self.messageBtn.addSubview(self.newMesRed)
        
        let setBtn = UIButton(frame: CGRect(x: kScreenWidth - 42, y: NavBarHight - 40, width: 30, height: 30))
        setBtn.setImage(UIImage(named: "icon_news_set"), for: .normal)
        setBtn.addTarget(self, action: #selector(setBtnAntion), for: .touchUpInside)
        self.navBar.addSubview(setBtn)
        
        setBtn.snp.makeConstraints { make in
            make.width.equalTo(30)
            make.height.equalTo(44)
            make.right.equalTo(-12)
            make.top.equalTo(IphoneTopArea)
        }
        
        messageBtn.snp.makeConstraints { make in
            make.right.equalTo(setBtn.snp.left).offset(-10)
            make.width.equalTo(30)
            make.height.equalTo(44)
            make.top.equalTo(IphoneTopArea)
        }
        
        signInBtn.snp.makeConstraints { make in
            make.right.equalTo(messageBtn.snp.left).offset(-10)
            make.top.equalTo(IphoneTopArea + 7)
            make.width.equalTo(30)
            make.height.equalTo(30)
        }
        self.setSignText(str: MMLocalizedString("sign_in", comment: "签到"))
    }
    
    ///设置签到的长度
    private func setSignText(str: String) {
        self.signInBtn.setup_titleLabel(text: str)
        signInBtn.titleLabel?.frame.size.width = 120
        signInBtn.titleLabel?.sizeToFit()
        let tempW = signInBtn.titleLabel?.frame.size.width ?? 0
        signInBtn.snp.updateConstraints { make in
            make.width.equalTo(tempW + 34)
        }
        self.navBar.updateConstraints()
        self.view.updateConstraints()
    }
    
    //渐变色
    func initLayer(frme: CGRect) -> UIImage?{
        let tempView = UIView(frame: frme)
        let bgLayer1 = CAGradientLayer()
        bgLayer1.colors = [UIColor(red: 1, green: 0.93, blue: 0.53, alpha: 1).cgColor, UIColor(red: 1, green: 0.71, blue: 0, alpha: 1).cgColor]
        bgLayer1.locations = [0, 1]
        bgLayer1.frame = tempView.bounds
        bgLayer1.startPoint = CGPoint(x: 0.5, y: 0)
        bgLayer1.endPoint = CGPoint(x: 1, y: 1)
        tempView.layer.addSublayer(bgLayer1)
        return tempView.gradient_image
    }
    
    func initTableView(){
        self.tableView = BaseTableView(frame: CGRect(x: 0, y: NavBarHight, width: kScreenWidth, height: kScreenHeight - TabbarHeight - NavBarHight), style: .plain)
        self.tableView.delegate = self
        self.tableView.dataSource = self
        self.tableView.rowHeight = UITableViewAutomaticDimension
        self.tableView.estimatedRowHeight = 2
        self.tableView.register(HotVehicleTableViewCell.self, forCellReuseIdentifier: "HotVehicleTableViewCell")//热门车辆
        self.tableView.register(RecommendedTableViewCell.self, forCellReuseIdentifier: "RecommendedTableViewCell")//推荐车辆
        self.tableView.backgroundColor = .clear
        self.view.addSubview(self.tableView)
        self.addPullRefreash()
        self.addLoadMoreRefreash()
    }
    
    func initKeFu(){
        self.customerServiceBtn = UIImageLabelButton.init(frame: CGRect.init(x: kScreenWidth - 54, y: kScreenHeight - 185, width: 40, height: 41))
        self.customerServiceBtn.titleLabel?.font = UIFont.init(name: Theme.PingFangSCRegular, size: 12)
        self.customerServiceBtn.titleLabel?.lineBreakMode = .byTruncatingTail
        self.customerServiceBtn.setup_image(image: UIImage.init(named: "icon_kefu"))
        self.customerServiceBtn.titleImageSpace = 2
        self.customerServiceBtn.imageLabelBtnType = .bottom
        self.customerServiceBtn.addTargetUsingBlock {[weak self] _ in
            self?.dealWhatsapp()
        }
        self.view.addSubview(self.customerServiceBtn)
    }
 
    func dealWhatsapp(){
        var tempStr = MMLocalizedString("salesman_whatapp_help", comment: "Hi! 我想搵架優質二手車，有咩車款推介呢?")
        let phone = "85262501888"
        tempStr = tempStr.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)!

        var tempUrl = "whatsapp://send?text=\(tempStr)"
        if (phone != "") {
            tempUrl = "whatsapp://send?phone=\(phone)&text=\(tempStr)"
        }
        guard let url = URL.init(string: tempUrl) else {
            return
        }
      
        if UIApplication.shared.canOpenURL(url) {
            UIApplication.shared.open(url, options: [:], completionHandler: nil)
        }else{//没安装WhatsApp
            var str =  MMLocalizedString("whatapp_help", comment: "我想搵架優質二手車，有咩車款推介呢?")
            str = str.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)!//反编码，如果没有不成功
            let noTemUrl = "https://wa.me/85262501888?text=Hi!" + str
          
            guard let url = URL.init(string: noTemUrl) else {
                return
            }
            UIApplication.shared.open(url, options: [:], completionHandler: nil)
        }
    }
    
    
    
    /*
     添加头部刷新
     */
    func addPullRefreash(){
        weak var weakSelf = self
        let header = MJRefreshNormalHeader.init(refreshingBlock: {
            weakSelf?.pageNumber = 1
            weakSelf?.fetchGetAppVersion() //版本号
            weakSelf?.requestSignIn() //是否签到
            weakSelf?.requestHotVehicleData() //热门车辆
            weakSelf?.requestRecommendedVehicle(isModel: false) //推荐车辆
        })
        header?.stateLabel.isHidden = true
        header?.setTitle("", for: .idle)
        header?.setTitle("", for: .pulling)
        header?.setTitle("", for: .refreshing)
        header?.activityIndicatorViewStyle = .gray
        self.tableView.mj_header = header
        self.tableView.mj_header.beginRefreshing()
        self.tableView.mj_header.beginRefreshing()
    }
    
    //MARK: - 上拉加载更多
    private func addLoadMoreRefreash()  {
        //weak var weakSelf = self
        self.tableView.mj_footer = ExtNoMoreRefreashFooterView.init(refreshingBlock: {
//            weakSelf?.pageNumber = self.pageNumber + 1
//            weakSelf?.requestRecommendedVehicle(isModel: true)
        })
        self.tableView.mj_footer?.endRefreshingWithNoMoreData()
    }
    
    ///我要买车-热门车辆  banner
    func requestHotVehicleData(){
        let param: [String: String] = ["isTop":"1"]
        XTRequestCenter.shared.sendRequestMappableTargetObject(target: APIManager.goonetcarUserdRecommand(param: param),objectType: HotVehicleModel.self) { data in
            self.view.handleLoading()
            self.tableView.mj_header?.endRefreshing()
            self.tableView.mj_footer?.endRefreshing()
            let resultObj = data as! HotVehicleModel
            if resultObj.code == "1" {
                let tempArr = resultObj.data ?? []
                tempArr.forEach { item in
                    item.favoriteBlock = {[weak self] in
                        self?.requestFavorite(model: item)
                    }
                }
                self.hotVehicleArray = tempArr
            }
            self.tableView.reloadData()
        }error: { err in
            self.tableView.mj_header?.endRefreshing()
            self.tableView.mj_footer?.endRefreshing()
            self.view.handleLoading()
        }
    }
    
    ////我要买车-推荐车辆
    func requestRecommendedVehicle(isModel: Bool){
        let param: [String: String] = ["pageNumber":"1", "pageSize": "9999"]
        XTRequestCenter.shared.sendRequestMappableTargetObject(target: APIManager.goonetcarUserdRecommand(param: param),objectType: HotVehicleModel.self) { data in
            self.view.handleLoading()
            self.tableView.mj_header?.endRefreshing()
            self.tableView.mj_footer?.endRefreshing()
            let resultObj = data as! HotVehicleModel
            if resultObj.code == "1" {
                let tempArr = resultObj.data ?? []
                tempArr.forEach { item in
                    item.favoriteBlock = {[weak self] in
                        self?.requestFavorite(model: item)
                    }
                }
                self.loadingFlag = true //加载过了
                self.recommendedArray = tempArr
            }
            self.tableView.reloadData()
        }error: { err in
            self.loadingFlag = true //加载过了
            self.tableView.mj_header?.endRefreshing()
            self.tableView.mj_footer?.endRefreshing()
            self.view.handleLoading()
        }
    }
 
    ///收藏取消收藏
    func requestFavorite(model: VehicleLisetModel){
        if UserModule.shared.isLogined == false{
            self.jumpToLogin()
            return
        }
        let param = ["usedcarId": "\(model.id ?? 0)", "dataType":"2"]
        XTRequestCenter.shared.sendRequestMappableTargetObject(target: APIManager.favorite(param: param),objectType: CommondResModel.self) { data in
            let resultObj = data as! CommondResModel
            if resultObj.code == "1" {
                if model.favorite == false {
                    self.view.makeToast(message: MMLocalizedString("successful_collection", comment: "收藏成功"))
                    model.favorite = true
                }else{
                    self.view.makeToast(message: MMLocalizedString("uncollected", comment: "已取消收藏"))
                    model.favorite = false
                }
                self.tableView.reloadData()
            }else{
                self.view.makeToast(message: resultObj.msg ?? "")
            }
        }error: { err in
            
        }
    }
    
    
    //取app版本号
    func fetchGetAppVersion() {
        let param = ["type":"2"]
        XTRequestCenter.shared.sendRequestMappableTargetObject(target: APIManager.getAppVersion(param: param),objectType: AppVersionModel.self) { data in
            let resultObj = data as! AppVersionModel
            if resultObj.code == "1" {
                let appVersion = resultObj.data?.appVersion ?? ""
               // 获取当下版本号
                let bundleVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as! String
                if appVersion > bundleVersion {
                    AppUpdateAlert.showUpdateAlert(data: resultObj.data!)
                }
            }
        }error: { err in
            
        }
    }
    
    //当前用户获得的推广活动
    func requestPromotionzActivity() {
        XTRequestCenter.shared.sendRequestMappableTargetObject(target: APIManager.promotionzActivity,objectType: PromotionActivityModel.self) { data in
            let resultObj = data as! PromotionActivityModel
            if resultObj.code == "1" {
                let dataArray = resultObj.data ?? []
                if dataArray.count > 0{
                    self.getPromotionActivity(dataArray: dataArray)
                }
            }
        }error: { err in
            
        }
    }

    
    //推广活动
    func getPromotionActivity(dataArray: [ActivityListModel]){
       let activityView = PromotionActivityView(frame: CGRect(x: 0, y: 0, width: kScreenWidth, height: kScreenHeight))
        activityView.setData(dataArray: dataArray)
       UIApplication.shared.delegate?.window??.addSubview(activityView)
        activityView.shareActivityDataBlock = { [weak self] model in
            let vc = ShareViewController()
            vc.titleStr = MMLocalizedString("share", comment: "分享")
            vc.isfaceBook = true
            //MMLocalizedString("share_article", comment: "我想与您分享以下文章") +
            vc.shareContent =  (model.sharePopularize ?? "")
            vc.shareUrl = model.sharePopularize ?? ""
            vc.modalPresentationStyle = .overFullScreen
            self?.present(vc, animated: false)
            vc.callBack = { [weak self] in
              self?.requestShareCoupon(data: model)
            }
        }
    }
    

    ///粘贴板 口令解析弹框
    @objc  func fetchGetOneCodeKey() {
        let pasedString = UIPasteboard.general.string ?? ""
        if pasedString == "" {
            return
        }
        guard pasedString.contains("popularizeId") else {
            return
        }
//        let userId = XTManageCenter.getLocalStringDataValue(aKey: XTManageCenter.userId)
//        if pasedString.contains(userId){//如果是自己的就不弹
//            return
//        }
        UIPasteboard.general.string = "" //清空粘贴板
        let lastString = pasedString.components(separatedBy: "&").last
        let id = lastString?.components(separatedBy: "=").last
        //查询推广活动的详情
        var param = NSMutableDictionary() as! [String : String]
        param["id"] = id
        XTRequestCenter.shared.sendRequestMappableTargetObject(target: APIManager.getDetailspromotion(param: param), objectType: PromotionDetailsModel.self, finished: { (response) in
            let resultObj = response as! PromotionDetailsModel
            if (resultObj.code == "1") {
                if resultObj.data != nil{
                    self.friendsShare(model: resultObj.data!)
                }
            }
        }) { (error ) in
            print(error as Any)
        }
    }
    
    //亲友分享
    func friendsShare(model: PromotionDetailsDataModel){
        let friendsShareView = FriendsShareView(frame: CGRect(x: 0, y: 0, width: kScreenWidth, height: kScreenHeight))
        friendsShareView.setModel(model: model)
        UIApplication.shared.delegate?.window??.addSubview(friendsShareView)
    }
    
    
    //签到领积分
    func requestSignIn() {
        XTRequestCenter.shared.sendRequestMappableTargetObject(target: APIManager.getSignIn,objectType: SignInModel.self) { data in
            let resultObj = data as! SignInModel
            if resultObj.code == "1" {
                self.signModel = resultObj.data
                if self.signModel?.signReward != nil {
                    if (self.signModel?.signReward?.isOpen ?? 0) == 0{
                        self.signInBtn.isHidden = true
                    }
                }
                if (self.signModel?.signStatus ?? 1) == 1{
                    self.setSignText(str: MMLocalizedString("signed", comment: "已签"))
//                    self.signInBtn.setTitle(MMLocalizedString("signed", comment: "已签"), for: .normal)
                }
            }
        }error: { err in
            
        }
    }
    
    //分享推广活动
    func requestShareCoupon(data: ActivityListModel){
        var param = NSMutableDictionary() as! [String : String]
        param["ids"] = "\(data.id ?? 0)"
        XTRequestCenter.shared.sendRequestMappableTargetObject(target: APIManager.shareActivities(param: param), objectType: PromotionDetailsModel.self, finished: { (response) in
            let resultObj = response as! PromotionDetailsModel
            if (resultObj.code == "1") {
                self.requestPromotionzActivity()//刷新
            }
        }) { (error ) in
            print(error as Any)
        }
    }
    
        
    
    //MARK: - Antion
    @objc func jumpToLogin(){
        guard let tabbarVC = UIApplication.shared.keyWindow?.rootViewController as? BaseTabbarController else {
            return
        }
        let vc = LoginViewController()
        let loginNavi = BaseNavigationController.init(rootViewController: vc)
        loginNavi.modalPresentationStyle = .fullScreen
        tabbarVC.present(loginNavi, animated: true)
    }
    
    
    //信息
   @objc func messageBtnAtion(){
       if UserModule.shared.isLogined == false{
           self.jumpToLogin()
           return
       }
       let vc = MessageViewController()
       self.navigationController?.pushViewController(vc, animated: true)
    }
    
    //个人中心
    @objc func setBtnAntion(){
        if UserModule.shared.isLogined == false{
            self.jumpToLogin()
            return
        }
        let vc = UserCenterViewController()
        self.navigationController?.pushViewController(vc, animated: true)
    }
 
    //点击通知栏的处理
    @objc func receiveJpushMsgTypeDeal(notification: Notification){
        let userInfo = notification.userInfo
        if let type = userInfo!["msgType"] as? String{//消息类型
            switch type {
            case "1"://站内讯息
                if UserModule.shared.isLogined == false{
                    self.jumpToLogin()
                    return
                }else{
                    self.pushMessageDetailVC(id: userInfo!["id"] as! String)
                }
            case "2"://服务预约提醒 点击通知栏消息，打开APP，进入会员奖赏。如果未登录，则跳转至登录页，登录成功后进入会员奖赏页。
                ()
            case "3"://积分失效提醒  点击通知栏消息，打开APP，进入会员奖赏。如果未登录，则跳转至登录页，登录成功后进入会员奖赏页。
                ()
            default:
                ()
            }
        }
    }
    
    //信息详情
    func pushMessageDetailVC(id: String){
        let vc = MessageDetailViewController()
        self.navigationController?.pushViewController(vc, animated: true)
    }
    
        
    //签到
    @objc func signInBtnBtnAtion(){
        if UserModule.shared.isLogined == false{
            self.jumpToLogin()
            return
        }
        if self.signModel != nil{
            self.signInPopView()
        }
    }
    
    func signInPopView(){
        if let url = URL.init(string: self.signModel.signReward?.backgroundImg ?? "") {
            self.view.showLoadingHUDText()
            let tempImg = UIImageView()
            tempImg.kf.setImage(with: url) { result in
                self.showSignPopView(bkgImage: tempImg.image)
            }
        }else{
            self.showSignPopView()
        }
    }
    
    private func showSignPopView(bkgImage: UIImage? = nil){
        self.view.handleLoading()
        self.setSignText(str: MMLocalizedString("signed", comment: "已签"))
//        self.signInBtn.setTitle(MMLocalizedString("signed", comment: "已签"), for: .normal)
        let signInView = SignInPopView(frame: CGRect(x: 0, y: 0, width: kScreenWidth, height: kScreenHeight))
        signInView.setModel(model: self.signModel, bkgImg: bkgImage)
        UIApplication.shared.delegate?.window??.addSubview(signInView)
        signInView.rulesAntionBlock = {[weak self] in
            let vc = WebViewController()
            vc.titleStr = MMLocalizedString("activity_rules", comment: "活动规则")
            vc.localHtmlStr = self?.signModel?.signReward?.description ?? ""
            self?.navigationController?.pushViewController(vc, animated: true)
        }
    }
}

extension OverSeaViewController: UITableViewDelegate,UITableViewDataSource{
    
    func numberOfSections(in tableView: UITableView) -> Int {
        return 2
    }
    
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
  
        return 1
    }
    
    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
        if self.hotVehicleArray.count == 0 && indexPath.section == 0 {
            return 0.01
        }
        return UITableViewAutomaticDimension
    }
    
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        switch indexPath.section {
        case 0:
            let cell = tableView.dequeueReusableCell(withIdentifier: "HotVehicleTableViewCell", for: indexPath) as! HotVehicleTableViewCell
                cell.seaCarFlag = true
            if self.hotVehicleArray.count > 0{
                cell.setDataArray(dataArray: self.hotVehicleArray)
            }
            return cell
        default:
            let cell = tableView.dequeueReusableCell(withIdentifier: "RecommendedTableViewCell", for: indexPath) as! RecommendedTableViewCell
                cell.seaCarFlag = true
                cell.loadingFlag = self.loadingFlag
                cell.setData(data: self.recommendedArray)
            return cell
        }
    }
    
    func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
            return 0.01
    }
    
    func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
        let headerView = UIView(frame: CGRect(x: 0, y: 0, width: kScreenWidth, height: 0.01))
          headerView.backgroundColor = .clear
        return headerView
    }
    
    
    func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
        return 0.01
    }
    
    func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
        let footerView = UIView(frame: CGRect(x: 0, y: 0, width: kScreenWidth, height: 0.01))
        footerView.backgroundColor = .clear
        return footerView
    }
}

extension OverSeaViewController: UIScrollViewDelegate{
    func scrollViewDidScroll(_ scrollView: UIScrollView) {
        let offset = scrollView.contentOffset.y
        if offset <= kScreenHeight/2 {
            self.goTopBtn.isHidden = true
        }else{
            self.goTopBtn.isHidden = false
        }
    }
}
